package gui;

import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.LayoutManager;

import javax.swing.JPanel;

import gui.properties.PropertiesPanel;

public class EditorLayout implements LayoutManager {
	private JPanel firstView;
	private JPanel secondView;
	private PropertiesPanel properties;
	private EditorWindowSettings settings;
	public EditorLayout(JPanel firstView, JPanel secondView, PropertiesPanel properties, EditorWindowSettings settings) {
		this.firstView = firstView;
		this.secondView = secondView;
		this.settings = settings;
		this.properties = properties;
	}
	
	public void addLayoutComponent(String arg0, Component arg1) {
				
	}

	public void layoutContainer(Container parent) {



		int propertiesWidth = settings.propertiesWidth;//properties.getWidth();
		int viewsSpaceWidth = parent.getWidth() - propertiesWidth;				
		int firstViewWidth = (int) (viewsSpaceWidth*(settings.firstViewPercent/100f));				

		int secondViewWidth = viewsSpaceWidth - firstViewWidth;

		
		firstView.setBounds(propertiesWidth, 0, firstViewWidth,parent.getHeight());
		secondView.setBounds(propertiesWidth + firstViewWidth, 0, secondViewWidth ,parent.getHeight());
		properties.setBounds(0, 0, propertiesWidth, parent.getHeight());	
	
	}

	public Dimension minimumLayoutSize(Container arg0) {
		// TODO Auto-generated method stub
		return new Dimension(1000,500);
	}

	public Dimension preferredLayoutSize(Container arg0) {
		// TODO Auto-generated method stub
		return new Dimension(1000,500);
	}

	public void removeLayoutComponent(Component arg0) {
		// TODO Auto-generated method stub
		
	}
	
}
